//
//  LCSNetworkingManager.m
//  LCSJieMianApp
//
//  Created by 千锋 on 15/12/18.
//  Copyright (c) 2015年 1000phone. All rights reserved.
//

#import "LCSNetworkingManager.h"

@implementation LCSNetworkingManager
{
    NSURLSession *_session;
}

+ (instancetype)manager
{
    LCSNetworkingManager *manager = [[LCSNetworkingManager alloc] init];
    return manager;
}

- (instancetype)init
{
    if (self = [super init]) {
        _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
    }
    return self;
}
- (void)GET:(NSString *)url  success:(RequestSuccess)success
{
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    
    NSURLSessionDataTask *task = [_session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (!error) {
            if (success) {
                success(response,data);
            }
        }
        }];
    [task resume];
}

@end
